<?php

/**
 * Job form.
 *
 * @package    maximous
 * @subpackage form
 * @author     Mina.Gerges.Wadea
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class JobForm extends BaseJobForm
{

    public function configure()
    {
        $filedas = array('category_id', 'title', 'description', 'contact_information', 'need_check', 'statues'); //,
        $maxUser = $this->getOption('maxUser');
        if ($maxUser && $maxUser instanceof MaxUser)
        {
            if ($maxUser->getMaxUserRole()->canView(SiteComponent::Company))
            {
                array_push($filedas, 'company_id');
            }
        }
        $this->useFields($filedas);
        $this->configureLoginUserRoleOnChangeStatusAndNeedCheck();
        $this->addFormatter('CustomFormatter');
    }

    public function doSave($con = null)
    {
        $maxUser = $this->getOption('maxUser');
        $this->getObject()->setUserId($maxUser->getUserDataByIndex('id'));
        parent::doSave($con);
    }

}
